# coding:utf-8

"""
生成train, test集
"""
import glob
import random
import cv2

img_files = glob.glob('D:\work\ObjectDetection\PyTorch-YOLOv3\data\lslm\images_ori\*.jpg')
txt_files = glob.glob('D:\work\ObjectDetection\PyTorch-YOLOv3\data\lslm\labels\*.txt')

# random.seed(0)
# random.shuffle(img_files)

# with open('data/lslm/val.txt','w') as f:
#     for x in img_files[:10]:
#         f.write(x+"\n")

# with open('data/lslm/train.txt','w') as f:
#     for x in img_files[10:]:
#         f.write(x+"\n")     

for imgpath in img_files:
    im = cv2.imread(imgpath)
    img = cv2.resize(im,(416,416))
    savepath = imgpath.replace("images_ori","images")
    cv2.imwrite(savepath, img)
